/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pkg_entidades;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Oswaldo
 */
@Entity
@Table(name = "stca_tipcaract", catalog = "sisventas_db", schema = "public")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tipcaract.findAll", query = "SELECT t FROM Tipcaract t"),
    @NamedQuery(name = "Tipcaract.findByTcaCodigo", query = "SELECT t FROM Tipcaract t WHERE t.tcaCodigo = :tcaCodigo"),
    @NamedQuery(name = "Tipcaract.findByTcaDescri", query = "SELECT t FROM Tipcaract t WHERE t.tcaDescri = :tcaDescri")})
public class Tipcaract implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "tca_codigo")
    private Integer tcaCodigo;
    @Size(max = 25)
    @Column(name = "tca_descri")
    private String tcaDescri;
    @OneToMany(mappedBy = "tcaCodigo")
    private List<Caracter> caracterList;
    @JoinColumn(name = "cat_codigo", referencedColumnName = "cat_codigo")
    @ManyToOne(optional = false)
    private Categoria catCodigo;

    public Tipcaract() {
    }

    public Tipcaract(Integer tcaCodigo) {
        this.tcaCodigo = tcaCodigo;
    }

    public Integer getTcaCodigo() {
        return tcaCodigo;
    }

    public void setTcaCodigo(Integer tcaCodigo) {
        this.tcaCodigo = tcaCodigo;
    }

    public String getTcaDescri() {
        return tcaDescri;
    }

    public void setTcaDescri(String tcaDescri) {
        this.tcaDescri = tcaDescri;
    }

    @XmlTransient
    public List<Caracter> getCaracterList() {
        return caracterList;
    }

    public void setCaracterList(List<Caracter> caracterList) {
        this.caracterList = caracterList;
    }

    public Categoria getCatCodigo() {
        return catCodigo;
    }

    public void setCatCodigo(Categoria catCodigo) {
        this.catCodigo = catCodigo;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (tcaCodigo != null ? tcaCodigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Tipcaract)) {
            return false;
        }
        Tipcaract other = (Tipcaract) object;
        if ((this.tcaCodigo == null && other.tcaCodigo != null) || (this.tcaCodigo != null && !this.tcaCodigo.equals(other.tcaCodigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return tcaDescri;
    }
    
}
